package com.xiaolin.order.controller;

import com.xiaolin.order.model.Order;
import com.xiaolin.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xiaolin
 * @description 订单服务
 * @since 2024/5/23
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;
    @Value("${flag}")
    private String flag;
    @Value("${env}")
    private String env;

    @GetMapping("/getOrders")
    public String getOrders() {
        return orderService.getOrderList();
    }

    @GetMapping("/createOrder")
    public String createOrder(Order order) {
        System.out.println("标记：" + flag);
        System.out.println("环境：" + env);
        return orderService.createOrder(order);
    }
}
